import qs from 'qs'
import requset from "@/utils/request";

enum URL {
  SystemDept = '/v1/admin/system/dept/index',
  SystemAddDept = '/v1/admin/system/dept/insert',
  SystemUpdateDept = '/v1/admin/system/dept/update',
  SystemDelDept = '/v1/admin/system/dept/delete',
  SystemDelFind = '/v1/admin/system/dept/find',
}

const sysDeptList = async (params:APISYSTEMDEPT.SysDeptParams) => requset<APISYSTEMDEPT.SysDeptList[]>({ url: URL.SystemDept, method:"GET",params })

const sysAddDept = async (data:APISYSTEMDEPT.SysDeptAdd) => requset({ url: URL.SystemAddDept,method:"POST",  data:qs.stringify(data) })

const sysUpdateDept = async (data:APISYSTEMDEPT.SysDeptUpdate) => requset({ url: URL.SystemUpdateDept,method:"PUT",  data:qs.stringify(data) })

const sysDelDept = async (id:string) => requset({ url: URL.SystemDelDept,method:"DELETE",  data:{id}})

const sysFindDept = async (id:string) => requset({ url: URL.SystemDelFind,method:"GET",  params:{id}})

export default { sysDeptList,sysAddDept,sysUpdateDept,sysDelDept,sysFindDept };
